﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using youzackcom.Model;

namespace youzackcom.EntityFrameworkCore.config
{
    public class PermissionConfig : IEntityTypeConfiguration<Permission>
    {
        public void Configure(EntityTypeBuilder<Permission> builder)
        {
            builder.ToTable("T_Permission");

            builder.Property(x => x.PermissionName).HasMaxLength(200).IsUnicode();
            //配置乐观锁     
            //builder.Property(h => h.version).IsConcurrencyToken();
            //builder.Property(h => h.PermissionName).IsRowVersion();
            //builder.HasMany(x => x.Comments).WithOne(c => c.Article).HasForeignKey(x => x.ArticleId).IsRequired(); //1对多
        }
    }
}
